home *** CD-ROM | disk | FTP | other *** search
- package javax.swing.text;
-
- import java.awt.event.ActionEvent;
- import javax.swing.JEditorPane;
-
- public abstract class StyledEditorKit$StyledTextAction extends TextAction {
- public StyledEditorKit$StyledTextAction(String var1) {
- super(var1);
- }
-
- protected final JEditorPane getEditor(ActionEvent var1) {
- JTextComponent var2 = ((TextAction)this).getTextComponent(var1);
- return var2 instanceof JEditorPane ? (JEditorPane)var2 : null;
- }
-
- protected final StyledDocument getStyledDocument(JEditorPane var1) {
- Document var2 = ((JTextComponent)var1).getDocument();
- if (var2 instanceof StyledDocument) {
- return (StyledDocument)var2;
- } else {
- throw new IllegalArgumentException("document must be StyledDocument");
- }
- }
-
- protected final StyledEditorKit getStyledEditorKit(JEditorPane var1) {
- EditorKit var2 = var1.getEditorKit();
- if (var2 instanceof StyledEditorKit) {
- return (StyledEditorKit)var2;
- } else {
- throw new IllegalArgumentException("EditorKit must be StyledEditorKit");
- }
- }
-
- protected final void setCharacterAttributes(JEditorPane var1, AttributeSet var2, boolean var3) {
- int var4 = ((JTextComponent)var1).getSelectionStart();
- int var5 = ((JTextComponent)var1).getSelectionEnd();
- if (var4 != var5) {
- StyledDocument var6 = this.getStyledDocument(var1);
- var6.setCharacterAttributes(var4, var5 - var4, var2, var3);
- }
-
- StyledEditorKit var8 = this.getStyledEditorKit(var1);
- MutableAttributeSet var7 = var8.getInputAttributes();
- if (var3) {
- var7.removeAttributes(var7);
- }
-
- var7.addAttributes(var2);
- }
-
- protected final void setParagraphAttributes(JEditorPane var1, AttributeSet var2, boolean var3) {
- int var4 = ((JTextComponent)var1).getSelectionStart();
- int var5 = ((JTextComponent)var1).getSelectionEnd();
- StyledDocument var6 = this.getStyledDocument(var1);
- var6.setParagraphAttributes(var4, var5 - var4, var2, var3);
- }
- }
-